<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <script type="text/javascript" src="../scripts/jquery/jquery-1.7.1.js"></script>
    <link href="../style/authority/basic_layout.css" rel="stylesheet" type="text/css">
    <link href="../style/authority/common_style.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="../scripts/authority/commonAll.js"></script>
    <link rel="stylesheet" href="../style/bootstrap.min.css"/>
    <script type="text/javascript" src="../scripts/jquery/jquery-1.4.4.min.js"></script>
    <script type="text/javascript" src="../scripts/fancybox/jquery.fancybox-1.3.4.js"></script>
    <script type="text/javascript" src="../scripts/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
    <link rel="stylesheet" type="text/css" href="../style/authority/jquery.fancybox-1.3.4.css" media="screen"></link>
    <script type="text/javascript" src="../scripts/artDialog/artDialog.js?skin=default"></script>
    <script type="text/javascript" src="../scripts/jquery.js"></script>
    <script type="text/javascript" src="../scripts/bootstrap.js"></script>
    <title>信息管理系统</title>
    <script type="text/javascript">
        function fun_a() {
            var jumpNumTxt = $("#jumpNumTxt").val();
            var pageCount = $("#pageCount").val();
            var pager = $("#pager").val();

            if (jumpNumTxt == null || jumpNumTxt == "") {
                alert("不能为空！");
            } else if (jumpNumTxt < 1) {
                alert("跳转页面不能小于1！");
            } else if (parseInt(jumpNumTxt) > parseInt(pageCount)) {
                alert("跳转页不能大于总页数！");
            } else if (parseInt(jumpNumTxt) == parseInt(pager)) {
                alert("不能跳转当前页！");
            } else {
                location.href = "/user/userAdmin?page=" + jumpNumTxt;
            }
        }
    </script>
    <style>
        .alt td {
            background: black !important;
        }
    </style>
</head>

<body>
<input type="hidden" name="allIDCheck" value="" id="allIDCheck"/>
<input type="hidden" name="fangyuanEntity.fyXqName" value="" id="fyXqName"/>
<div id="container">
    <div class="ui_content">
        <div class="ui_text_indent">
            <div id="box_border">
                <div id="box_top"><span class="glyphicon glyphicon-user"></span>&nbsp;角色</div>
                <div id="box_bottom" style="background-color: #CCCCCC;text-align: left">
                    <a href="#" data-toggle="modal" data-target="#add">
                        <span class="glyphicon glyphicon-plus" style="color: #00B83F;"></span> 增加
                    </a>&nbsp;&nbsp;
                    <a href="#" onclick="role_delete()">
                        <span class="glyphicon glyphicon-remove" style="color:red;"></span> 删除
                    </a>&nbsp;&nbsp;
                    <a href="#" id="updateRole" onclick="role_update()">
                        <span class="glyphicon glyphicon-pencil" style="color: #02397F;"></span> 编辑
                    </a>&nbsp;&nbsp;
                    <a href="#">
                        <span class="glyphicon glyphicon-ok" style="color:#00B83F;;"></span> 分配资源
                    </a>
                </div>

            </div>
            <div class="box_bottom">
                <table class="table table-striped table-hover table-condensed">
                    <tr>
                        <td>
                            <input type="checkbox" id="all" onclick="selectOrClearAllCheckbox(this);"/>
                        </td>
                        <td width="30%"><b style="color: #000000">名称</b></td>
                        <td width="70%"><b style="color: #000000">描述</b></td>
                    </tr>
                    <tr th:each="role : ${roleManagers}" th:Object="${role}">
                        <td>
                            <input type="checkbox" name="box" th:value="*{id}"/>
                        </td>

                        <td>
                            <a th:href="@{/role/RoleManager?department=}+*{id}">
                                <span th:text="*{rolename}"></span>
                            </a>
                        </td>

                        <td th:text="*{roleDescribe}"></td>
                    </tr>
                </table>
            </div>
        </div>
    </div>

    <!--增加的模态框-->
    <div class="modal fade" id="add">
        <div class="modal-dialog">
            <div class="modal-content" style="width: 400px;">
                <div class="modal-header">
                    <button class="close" data-dismiss="modal">×</button>
                    <p>
                        <span style="font-size:16px; font-weight:normal">增加角色</span>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <span id="hint" style="color: red"></span>
                    </p>
                </div>
                <form action="/role/RoleSave" method="post" onSubmit="return addRole(this)">
                    <div class="media-body container">
                        <br>
                        <table class="table table-condensed col-md-12">
                            <tr valign="middle" align="center">
                                <td>名称:</td>
                                <td>
                                    <input type="text" id="rolename" name="rolename"/>
                                </td>
                            </tr>
                            <tr valign="middle" align="center">
                                <td>描述:</td>
                                <td>
                                    <textarea id="roleDescribe" name="roleDescribe" rows="2" cols="20"
                                              style="resize:none"></textarea>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div class="modal-footer">
                        <button type="submit" class="btn btn-info btn-block">提交</button>
                        <input type="button" class="btn btn-warning btn-block" data-dismiss="modal" value="取消"/>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <!--结束-->
    <!--修改的模态框-->
    <div class="modal fade" id="update">
        <div class="modal-dialog">
            <div class="modal-content" style="width: 450px;">
                <div class="modal-header">
                    <button class="close" data-dismiss="modal">×</button>
                    <p>
                        <span style="font-size:16px; font-weight:normal">编辑角色</span>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <span id="updateHint" style="color: red"></span>
                    </p>
                </div>
                <form action="/role/RoleSave" method="post" onSubmit="return updateRole(this)">
                    <div class="media-body container">
                        <br>
                        <input type="hidden" id="RoleId" name="id">
                        <table class="table table-condensed col-md-12">
                            <tr valign="middle" align="center">
                                <td>名称:</td>
                                <td><input type="text" id="rolename2" name="rolename"/></td>
                            </tr>
                            <tr valign="middle" align="center">
                                <td>描述:</td>
                                <td>
                                    <textarea id="roleDescribe2" name="roleDescribe" rows="2" cols="20"
                                              style="resize:none"></textarea>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div class="modal-footer">
                        <button type="submit" class="btn btn-info btn-block">确定</button>
                        <input type="button" class="btn btn-warning btn-block" data-dismiss="modal" value="取消"/>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <!--结束-->

    <div class="ui_content" style="">
        <div class="ui_tb">
            <table class="table" cellspacing="0" cellpadding="0" width="100%" align="center" border="0">
                <tr>
                    <th>用户名</th>
                    <th>姓名</th>
                    <th>邮箱</th>
                    <th>电话</th>
                    <th>状态</th>
                    <th>部门</th>
                </tr>
                <tr th:each="user : ${userAll.dataS}" th:Object="${user}">
                    <td th:text="*{user.username}"></td>
                    <td th:text="*{user.name}"></td>
                    <td th:text="*{user.postbox}"></td>
                    <td th:text="*{user.phone}"></td>
                    <td th:text="停用" th:if="*{user.status == 0}"></td>
                    <td th:text="正常" th:if="*{user.status == 1}"></td>
                    <td th:text="*{auditInstitution.auditname}"></td>
                </tr>
            </table>
        </div>
        <div class="ui_tb_h30">
            <div class="ui_flt" style="height: 30px; line-height: 30px;">

                <span class="ui_txt_bold04" th:text="'共有 '+${userAll.pageCount} + ' 条记录，当前第 '"></span>
                <span class="ui_txt_bold04" th:text="${pager}+'/'+${userAll.pageCount}+' 页'"></span>
                <input id="pageCount" type="hidden" th:value="${userAll.pageCount}">
                <input id="pager" type="hidden" th:value="${pager}">
            </div>
            <div class="ui_frt">
                <!--    如果是第一页，则只显示下一页、尾页 -->
                <a href="/role/RoleManager?page=1">
                    <input type="button" value="首页" class="ui_input_btn01"/>
                </a>
                <a th:href="@{/role/RoleManager?page=}+(${pager-1}<1?1:${pager-1})">
                    <input type="button" value="上一页" class="ui_input_btn01"/>
                </a>
                <a th:href="@{/role/RoleManager?page=}+(${pager+1}>${userAll.pageCount}?${userAll.pageCount}:${pager+1})">
                    <input type="button" value="下一页" class="ui_input_btn01"/>
                </a>
                <a th:href="@{/role/RoleManager?page=}+${userAll.pageCount}">
                    <input type="button" value="尾页" class="ui_input_btn01"/>
                </a>
                <!--     如果是最后一页，则只显示首页、上一页 -->
                转到第<input type="text" id="jumpNumTxt" class="ui_input_txt01" value=""/>页
                <input type="button" class="ui_input_btn01" value="跳转" onclick="fun_a()"/>
            </div>
        </div>
    </div>
</div>
<div style="display:none">
    <script src='http://v7.cnzz.com/stat.php?id=155540&web_id=155540' language='JavaScript' charset='gb2312'></script>
</div>
</body>
</html>
<script type="text/javascript" src="../js/RoleManager.js"></script>